<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <meta name="description" content="Your description goes here" />
        <meta name="keywords" content="power control electricity meter" />
        <meta name="author" content="Benny Saxen" />
        <link rel="stylesheet" type="text/css" href="bessvx.css" title="bessvx" media="screen,projection" />
<?
include("bessLib.php");
readConf();

echo("        <title>BESSVX $g_bess_user</title>
</head>");



//$k0 = msTimeStamp();

$yearStart = 2013;
$yearEnd   = 2050;
echo("
<STYLE type=text/css>
A:link {COLOR: blue;text-decoration:none;}
A:visited {COLOR: blue}
A:hover {COLOR: green}
BODY {COLOR: black} 
</STYLE>
");
session_start(); 

$g_width     = $_SESSION['g_width'];
$g_height    = $_SESSION['g_height'];
$g_scale     = $_SESSION['g_scale'];
$g_ymax      = $_SESSION['g_ymax'];
$g_filter    = $_SESSION['g_filter'];

$a_tolerance     = $_SESSION['a_tolerance'];
$a_pow_lim       = $_SESSION['a_pow_lim'];
$a_min_box_width = $_SESSION['a_min_box_width'];

$s_view      = $_SESSION['s_view'];
$s_view_p    = $_SESSION['s_view_p'];

$s_year[1]   = $_SESSION['s_year1'];
$s_month[1]  = $_SESSION['s_month1'];
$s_day[1]    = $_SESSION['s_day1'];
$s_hour[1]   = $_SESSION['s_hour1'];
$s_min10[1]  = $_SESSION['s_min10_1'];
$s_scope[1]  = $_SESSION['s_scope1'];

$s_year[2]   = $_SESSION['s_year2'];
$s_month[2]  = $_SESSION['s_month2'];
$s_day[2]    = $_SESSION['s_day2'];
$s_hour[2]   = $_SESSION['s_hour2'];
$s_scope[2]  = $_SESSION['s_scope2'];

//$k1 = msTimeStamp();$temp = $k1-$k0;echo("A1 $temp <br>");$k0=$k1;


$temp                       = $_POST['s_year1'];
if($temp)$s_year[1]         = $_POST['s_year1'];
if(!$s_year[1])$s_year[1]   = date('Y');

$temp                       = $_POST['s_month1'];
if($temp)$s_month[1]        = $_POST['s_month1'];
if(!$s_month[1])$s_month[1] = date('m');
$s_month[1] += 0;

$temp                       = $_POST['s_day1'];
if($temp)$s_day[1]          = $_POST['s_day1'];
if(!$s_day[1])$s_day[1]     = date('d');
$s_day[1] += 0;

$temp                       = $_POST['s_year2'];
if($temp)$s_year[2]         = $_POST['s_year2'];
if(!$s_year[2])$s_year[2]   = date('Y');

$temp                       = $_POST['s_month2'];
if($temp)$s_month[2]        = $_POST['s_month2'];
if(!$s_month[2])$s_month[2] = date('m');
$s_month[2] += 0;

$temp                       = $_POST['s_day2'];
if($temp)$s_day[2]          = $_POST['s_day2'];
if(!$s_day[2])$s_day[2]     = date('d') - 1;
$s_day[2] += 0;

if(!$s_hour[1])$s_hour[1] = date('h');


// GET
//=======================================
$action  = $_GET['action'];
//=======================================
if($action == 'defview')
{
   $g_width  = 1000;
   $g_height = 300;
   $g_scale  = 500;
   $g_ymax   = 5000;
   $g_filer  = 1;
}
if($action == 'expview')
{
   $g_width  = 10000;
   $g_height = 300;
   $g_scale  = 500;
   $g_ymax   = 5000;
   $g_filer  = 1;
}
if($action == 'start')
{
  system("sudo ./bessvx &");
}

if($action == 'nextDay')
{
  $s_day[1]++;
}
if($action == 'prevDay')
{
  $s_day[1]--;
}
if($action == 'nextHour')
{
  $s_hour[1]++;
}
if($action == 'prevHour')
{
  $s_hour[1]--;
}
if($action == 'nextMin10')
{
  $s_min10[1]++;
}
if($action == 'prevMin10')
{
  $s_min10[1]--;
}

if($action == 'update')
{
  updateAll();
}

if($action == 'analysis_on')
{
  $t_analysis = 1;
}

if($action == 'analysis_off')
{
  $t_analysis = 0;
}

if($action == 'zip')
{
  echo("Create zip...<br>");
  system("rm -f data.zip; zip -q data.zip data/*;");
  echo("Zip ready!<br>");
}

if($action == 'clear')
{
  system("rm -r data;");
  echo("Databas rensad!<br>");
}

if($action == 'export')
{
  $expFile  = $_GET['expFile'];
  echo("$expFile<br>");
  system("rm -f data.zip; zip -q data.zip $expFile;");
  echo("Zip ready!<br>");
}

if($action == 'nowAll')
{
  $s_hour[1]   = date('h');
  $s_day[1]    = date('d');
  $s_month[1]  = date('m');
  $s_year[1]   = date('Y');
  $temp = date('i');
  $temp = floor($temp/10);
  $s_min10[1]   = $temp;
}

if($action == 'nowDay')
{
  $s_day[1]    = date('d');
  $s_month[1]  = date('m');
  $s_year[1]   = date('Y');
}

if($action == 'nowHour')
{
  $s_hour[1]   = date('h');
}

if($action == 'nowMin10')
{
  $temp = date('i');
  $temp = floor($temp/10);
  $s_min10[1]   = $temp;
}

// POST
//=======================================
$f_event  = $_POST['f_event'];
//=======================================

//--------------------------
if($f_event == 'event_import') 
{
   $upFile = uploadFile();
}
//--------------------------
if($f_event == 'event_conf') 
{
   $s_view = $s_view_p;
   $gw  = $_POST['g_width'];
   if($gw) $g_width = $gw;
   $gw  = $_POST['g_height'];
   if($gw) $g_height = $gw;
   $gw  = $_POST['g_scale'];
   if($gw) $g_scale = $gw;
   $gw  = $_POST['g_ymax'];
   if($gw) $g_ymax = $gw;
   $gw  = $_POST['g_filter'];
   if($gw) $g_filter = $gw;
}

//--------------------------
if($f_event == 'event_analysis') 
{
   $gw  = $_POST['a_tolerance'];
   if($gw) $a_tolerance = $gw;
   $gw  = $_POST['a_pow_lim'];
   if($gw) $a_pow_lim = $gw;
   $gw  = $_POST['a_min_box_width'];
   if($gw) $a_min_box_width = $gw;
}

//--------------------------
if($f_event == 'event_view')
{
  $temp = $_POST['s_view'];
  if($temp)
  {
    $s_view_p = $s_view;
    $s_view   = $temp;
  }
  if(!$s_view)$s_view   = 'VIEW_HOUR';
}

//--------------------------
if($f_event == 'event_hour')
{
  $s_hour[1]        = $_POST['s_hour1'] - 1;
  $s_hour[2]        = $_POST['s_hour2'] - 1;
  //if(!$s_hour[1])$s_hour[1]  = date('h');
  //if(!$s_hour[2])$s_hour[2]  = date('h');
}

//--------------------------
if($f_event == 'event_min10')
{
  $s_min10[1]        = $_POST['s_min10_1'] - 1;
}



// Default values
if(!$g_width)$g_width   = 1000;
if(!$g_height)$g_height = 300;
if(!$g_scale)$g_scale   = 500;
if(!$g_ymax)$g_ymax     = 5000;
if(!$g_filter)$g_filter = 1;
if(!$s_view)$s_view     = 'VIEW_HOUR';
if(!$a_tolerance)$a_tolerance         = 20;
if(!$a_pow_lim)$a_pow_lim             = 1000;
if(!$a_min_box_width)$a_min_box_width = 50;

$_SESSION['g_width']   = $g_width;
$_SESSION['g_height']  = $g_height;
$_SESSION['g_scale']   = $g_scale;
$_SESSION['g_ymax']    = $g_ymax;
$_SESSION['g_filter']  = $g_filter;

$_SESSION['a_tolerance'] = $a_tolerance;
$_SESSION['a_pow_lim']   = $a_pow_lim; 
$_SESSION['a_min_box_width'] = $a_min_box_width;

$_SESSION['s_view']    = $s_view;
$_SESSION['s_view_p']  = $s_view_p;

$_SESSION['s_year1']   = $s_year[1];
$_SESSION['s_month1']  = $s_month[1];
$_SESSION['s_day1']    = $s_day[1];
$_SESSION['s_hour1']   = $s_hour[1];
$_SESSION['s_min10_1'] = $s_min10[1];
$_SESSION['s_scope1']  = $s_scope[1];

$_SESSION['s_year2']   = $s_year[2];
$_SESSION['s_month2']  = $s_month[2];
$_SESSION['s_day2']    = $s_day[2];
$_SESSION['s_hour2']   = $s_hour[2];
$_SESSION['s_scope2']  = $s_scope[2];

$conf[width] = $g_width;$conf[height] = $g_height;$conf[scale] = $g_scale;
$conf[ymax] = $g_ymax;

$year = $s_year[1]; $month = $s_month[1]; $day = $s_day[1];
closeDataFiles();
lessDataFiles($year,$month,$day); 

//===================================================
// HTML
//===================================================

echo("<html><head><script src=\"js/processing.js\"></script>");
echo("<a href=\"bessvx.php?action=defview\"> normal view</a> |");
echo("<a href=\"bessvx.php?action=expview\"> expand view</a> |");

//echo("<a href=\"bessvx.php?action=start\"> start</a> |");
//echo("<a href=\"bessvx.php?action=update\"> uppdatera</a>");
echo(" Selected time: $year-$month-$day User: $g_bess_user  [Pulse: $g_pulse_rate Log: $g_log_rate]");
echo("<form action=\"bessvx.php\" method=\"POST\">");
echo("<input name=\"f_event\"  type=\"hidden\" value=\"event_view\"/>");
echo("<select name=\"s_view\">");

$selected = '';if($s_view == 'VIEW_CUR')$selected = 'selected';
echo("<option $selected value=\"VIEW_CUR\">just nu</option>");

$selected = '';if($s_view == 'VIEW_LESS_H')$selected = 'selected';
echo("<option $selected value=\"VIEW_LESS_H\">dygn tim</option>");

$selected = '';if($s_view == 'VIEW_LESS_M')$selected = 'selected';
echo("<option $selected value=\"VIEW_LESS_M\">dygn min</option>");

$selected = '';if($s_view == 'VIEW_DAY1')$selected = 'selected';
echo("<option $selected value=\"VIEW_DAY1\">dygn sek</option>");

//$selected = '';if($s_view == 'VIEW_DAY2')$selected = 'selected';
//echo("<option $selected value=\"VIEW_DAY2\">dygn 1 och 2</option>");

$selected = '';if($s_view == 'VIEW_HOUR')$selected = 'selected';
echo("<option $selected value=\"VIEW_HOUR\">timme</option>");

$selected = '';if($s_view == 'VIEW_MIN10')$selected = 'selected';
echo("<option $selected value=\"VIEW_MIN10\">timme 10min</option>");

$selected = '';if($s_view == 'VIEW_TOT')$selected = 'selected';
echo("<option $selected value=\"VIEW_TOT\">total</option>");

//$selected = '';if($s_view == 'VIEW_ACC')$selected = 'selected';
//echo("<option $selected value=\"VIEW_ACC\">ackumulerat</option>");

$selected = '';if($s_view == 'VIEW_CONF')$selected = 'selected';
echo("<option $selected value=\"VIEW_CONF\">konfiguration</option>");

$selected = '';if($s_view == 'VIEW_EXP')$selected = 'selected';
echo("<option $selected value=\"VIEW_EXP\">exportera</option>");

$selected = '';if($s_view == 'VIEW_IMP')$selected = 'selected';
echo("<option $selected value=\"VIEW_IMP\">importera</option>");

$selected = '';if($s_view == 'VIEW_GRAPHNOW')$selected = 'selected';
echo("<option $selected value=\"VIEW_GRAPHNOW\">graf nu</option>");

echo("</select>");
echo("<input type=\"submit\" value=\"vy\" name=\"submit\"></form>");

//====================================================
if($s_view == 'VIEW_CUR')
{
 echo("
  <script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js\"></script>
  <script type=\"text/javascript\">
  function update()
  {
   $.get(\"ajax.php\", {user: '1'}, function(data){ $(\"#getmytime\").html(data);});  
   setTimeout('update()', 1000);
  }
  $(document).ready(function(){update();});
  </script>

  </head>

  <body>
 ");

 echo date(DATE_RFC822);
 echo("<h1><div id=\"getmytime\">no data</div></h1>");
}
//====================================================
if($s_view == 'VIEW_GRAPHNOW')
{
  echo("</head><body>");
  $yy = $s_year[1]; $mm = $s_month[1]; $dd = $s_day[1];
  $sDate1 = $yy.'-'.$mm.'-'.$dd;
  //$conf[kwh] = $distDay[$yy][$mm][$dd]/1000;
  //$conf[scope] = 'day';
  $conf[hour] = $s_hour[1];
  $conf[filter] = $g_filter;
  createPDE_graphNow("pde/graphNow.pde",$sDate1,$conf);

  setDay(1,$yy,$mm,$dd);

  echo("<div style=\"margin-top:10px;\" id=upper1 align=left margin>");
  echo("<canvas data-processing-sources=\"pde/graphNow.pde\"></canvas>");
  echo("</div>");
}
//====================================================
if($s_view == 'VIEW_LESS_H')
{
  echo("</head><body>");
  $yy = $s_year[1]; $mm = $s_month[1]; $dd = $s_day[1];
  $sDate1 = getFileName('hour',$yy,$mm,$dd,'less');
  $conf[kwh] = $distDay[$yy][$mm][$dd]/1000;
  $conf[scope] = 'day';
  $conf[hour] = 23;
  $conf[filter] = $g_filter;
  createPDE_lessHour("pde/lessHour.pde",$sDate1,$conf);

  setDay(1,$yy,$mm,$dd);
  echo("<a href=\"bessvx.php?action=prevDay\"> <= </a>");
  echo("<a href=\"bessvx.php?action=nowDay\"> dygn nu</a> ");
  echo("<a href=\"bessvx.php?action=nextDay\"> => </a>");
  
  echo("<div style=\"margin-top:10px;\" id=upper1 align=left margin>");
  echo("<canvas data-processing-sources=\"pde/lessHour.pde\"></canvas>");
  echo("</div>");
}
//====================================================
if($s_view == 'VIEW_LESS_M')
{
  echo("</head><body>");
  $yy = $s_year[1]; $mm = $s_month[1]; $dd = $s_day[1];
  $sDate1 = getFileName('minute',$yy,$mm,$dd,'less');
  $conf[kwh] = $distDay[$yy][$mm][$dd]/1000;
  $conf[scope] = 'day';
  $conf[hour] = 23;
  $conf[filter] = $g_filter;
  createPDE_lessMinute("pde/lessMinute.pde",$sDate1,$conf);

  setDay(1,$yy,$mm,$dd);
  echo("<a href=\"bessvx.php?action=prevDay\"> <= </a>");
  echo("<a href=\"bessvx.php?action=nowDay\"> dygn nu</a> ");
  echo("<a href=\"bessvx.php?action=nextDay\"> => </a>");
  
  echo("<div style=\"margin-top:10px;\" id=upper1 align=left margin>");
  echo("<canvas data-processing-sources=\"pde/lessMinute.pde\"></canvas>");
  echo("</div>");
}
//====================================================
if($s_view == 'VIEW_EXPERIMENT')
{
  echo("</head><body>");
  $yy = $s_year[1]; $mm = $s_month[1]; $dd = $s_day[1];
  $sDate1 = $yy.'-'.$mm.'-'.$dd;
  $conf[kwh] = $distDay[$yy][$mm][$dd]/1000;
  $conf[scope] = 'day';
  $conf[hour] = 23;
  $conf[filter] = $g_filter;
  $conf[less] = 'min';
  createPDE_less("pde/less.pde",$sDate1,$conf);

  setDay(1,$yy,$mm,$dd);

  echo("<div style=\"margin-top:10px;\" id=upper1 align=left margin>");
  echo("<canvas data-processing-sources=\"pde/less.pde\"></canvas>");
  echo("</div>");
}
//====================================================
if($s_view == 'VIEW_DAY1' || $s_view == 'VIEW_DAY2')
{
  echo("</head><body>");
  $yy = $s_year[1]; $mm = $s_month[1]; $dd = $s_day[1];
  $sDate1 = $yy.'-'.$mm.'-'.$dd;
  $file = getFileName('day',$yy,$mm,$dd,'close');
  
  $maxValue = readFileMax($file);
  $conf[ymax] = 1000;
  for($ii=1;$ii<50;$ii++)
  {
     $temp = $ii*1000;
     if($maxValue > $temp) $conf[ymax] = $temp+1000;
  }
  
  $conf[kwh] = $distDay[$yy][$mm][$dd]/1000;
  $conf[scope] = 'day'; $conf[hour] = 23;$conf[min10] = 99;
  $conf[filter] = $g_filter;
  createPDE_single("pde/day1.pde",$sDate1,$conf);

  setDay(1,$yy,$mm,$dd);
  echo("<a href=\"bessvx.php?action=prevDay\"> <= </a>");
  echo("<a href=\"bessvx.php?action=nowDay\"> dygn nu</a> ");
  echo("<a href=\"bessvx.php?action=nextDay\"> => </a>");

  echo("<div style=\"margin-top:10px;\" id=upper1 align=left margin>");
  echo("<canvas data-processing-sources=\"pde/day1.pde\"></canvas>");
  echo("</div>");
}
//====================================================
if($s_view == 'VIEW_DAY2')
{
  echo("</head><body>");
  $yy = $s_year[2]; $mm = $s_month[2]; $dd = $s_day[2];
  $sDate2 = $yy.'-'.$mm.'-'.$dd;
  $conf[kwh] = $distDay[$yy][$mm][$dd]/1000;
  $conf[scope] = 'day';$conf[hour] = 23;$conf[min10] = 99;
  $conf[filter] = $g_filter;
  createPDE_single("pde/day2.pde",$sDate2,$conf);

  setDay(2,$yy,$mm,$dd);

  echo("<div style=\"margin-top:10px;\" id=upper1 align=left margin>");
  echo("<canvas data-processing-sources=\"pde/day2.pde\"></canvas>");
  echo("</div>");
}
//====================================================
if($s_view == 'VIEW_HOUR'|| $s_view == 'VIEW_MIN10')
{
  echo("</head><body>");
  $yy = $s_year[1]; $mm = $s_month[1]; $dd = $s_day[1]; $hh = $s_hour[1];
  $sDate1 = $yy.'-'.$mm.'-'.$dd;
  $conf[kwh] = $distHour[$yy][$mm][$dd][$hh]/1000;
  $conf[scope] = 'hour';$conf[hour] = $hh;$conf[min10] = 99;
  $conf[filter] = $g_filter;

  createPDE_single("pde/hour.pde",$sDate1,$conf);

  setHour(1,$hh); echo("$sDate1");
  echo("<a href=\"bessvx.php?action=prevHour\"> <= </a>");
  echo("<a href=\"bessvx.php?action=nowHour\"> timme nu</a> ");
  echo("<a href=\"bessvx.php?action=nextHour\"> => </a>");

  echo("<div style=\"margin-top:10px;\" id=upper1 align=left margin>");
  echo("<canvas data-processing-sources=\"pde/hour.pde\"></canvas>");
  echo("</div>");
}
//====================================================
if($s_view == 'VIEW_MIN10')
{
  echo("</head><body>");
  $yy = $s_year[1]; $mm = $s_month[1]; $dd = $s_day[1]; $hh = $s_hour[1];$min10 = $s_min10[1];
  $sDate1 = $yy.'-'.$mm.'-'.$dd;
  $conf[kwh] = $distHour[$yy][$mm][$dd][$hh]/1000;
  $conf[scope] = 'min10';$conf[hour] = $hh;$conf[min10] = $min10;
  $conf[filter] = $g_filter;
  createPDE_single("pde/min10.pde",$sDate1,$conf);

  setMin10(1,$min10); echo("$sDate1 hour=$hh");
  echo("<a href=\"bessvx.php?action=prevMin10\"> <= </a>");
  echo("<a href=\"bessvx.php?action=nowMin10\"> 10min nu</a> ");
  echo("<a href=\"bessvx.php?action=nextMin10\"> => </a>");

  echo("<div style=\"margin-top:10px;\" id=upper1 align=left margin>");
  echo("<canvas data-processing-sources=\"pde/min10.pde\"></canvas>");
  echo("</div>");
  //genConsumers($sDate1,$conf);
}
//====================================================
if($s_view == 'VIEW_ACC')
{
  echo("</head><body>");
  $yy = $s_year[2]; $mm = $s_month[2]; $dd = $s_day[2];
  $sDate2 = $yy.'-'.$mm.'-'.$dd;
  $conf[kwh] = $distDay[$yy][$mm][$dd]/1000;
  $conf[scope] = 'day';$conf[hour] = 23;
  $conf[ymax]   = 30000;
  $conf[width]  = 1000;
  $conf[height] = 300;
  $conf[scale]  = 5000;
  $conf[filter] = $g_filter;
  createPDE_acc("pde/bess_acc.pde",$sDate1,$sDate2,$conf);


  setDay(2,$yy,$mm,$dd);

  echo("<div style=\"margin-top:10px;\" id=upper1 align=left margin>");
  echo("<canvas data-processing-sources=\"pde/bess_acc.pde\"></canvas>");
  echo("</div>");
}
//====================================================
if($s_view == 'VIEW_TOT')
{
  echo("</head><body>");
  $yy = $s_year[1];
  $mm = $s_month[1];

  $conf[kwh] = $distYear[$yy]/1000;
  $conf[scope] = 'day';$conf[hour] = 23;
  createPDE_year("pde/year.pde",$yy,$conf);


  $conf[kwh] = $distMonth[$yy][$mm]/1000;
  $conf[scope] = 'day';$conf[hour] = 23;
  createPDE_month("pde/month.pde",$yy,$mm,$conf);
  setMonth(1,$yy,$mm);
  
  echo("<div style=\"margin-top:10px;\" id=upper1 align=left margin>");
  echo("<canvas data-processing-sources=\"pde/year.pde\"></canvas>");
  echo("</div>");
  echo("<div style=\"margin-top:10px;\" id=upper1 align=left margin>");
  echo("<canvas data-processing-sources=\"pde/month.pde\"></canvas>");
  echo("</div>");
}
//====================================================
if($s_view == 'VIEW_CONF')
{
  echo("</head><body>");
  echo("<form action=\"bessvx.php\" method=\"POST\">");
  echo("<input name=\"f_event\"  type=\"hidden\" value=\"event_conf\"/>");
  echo("Bredd      <input name=\"g_width\"  type=\"text\" value=\"$g_width\"  size=\"3\"/>");
  echo("H&ouml;jd  <input name=\"g_height\" type=\"text\" value=\"$g_height\" size=\"3\"/>");
  echo("Delning    <input name=\"g_scale\"  type=\"text\" value=\"$g_scale\"  size=\"3\"/>");
  echo("Skala Watt <input name=\"g_ymax\"   type=\"text\" value=\"$g_ymax\"   size=\"3\"/>");
  echo("Filter     <input name=\"g_filter\" type=\"text\" value=\"$g_filter\" size=\"3\"/>");
  echo("<input type=\"submit\" value=\"V&auml;lj\" name=\"submit\"></form>");
}
//====================================================
if($s_view == 'VIEW_EXP')
{
  echo("</head><body>");
  echo(" <a href=\"bessvx.php?action=zip\">skapa zip</a>");
  echo(" | <a href=\"data.zip\">ladda ner data</a><br>");
  if ($expFile)echo("<a href=\"temp-data.bess\">ladda ner fil</a><br>");

  $in  = fopen("bess-log-list.txt","r");
  if($in)
  {
      while (!feof($in))
      {
          $expFile = trim(fgets($in));
          $temp2 = str_replace("bess-", "", $expFile);
          $temp2 = str_replace(".txt", "", $temp2);
          $temp2 = str_replace("data/", "", $temp2);
          echo(" <a href=\"bessvx.php?action=export&expFile=$expFile\">$temp2</a><br>");
          $time  = explode("-", $temp2);
          $year  = $time[0];
          $month = $time[1];
          $day   = $time[2];
      }
      fclose($in);
   }
}
//====================================================
if($s_view == 'VIEW_IMP')
{
  echo("</head><body>");
  echo("<form action=\"bessvx.php\" method='POST' enctype='multipart/form-data'>");
  echo("<input name=\"f_event\"  type=\"hidden\" value=\"event_import\"/>");
  echo("<input name=\"import_file\"  type=\"file\"/>");
  echo("<input type=\"submit\" value=\"ladda upp\" name=\"submit_file\"></form>");
  echo("<br><a href=\"bessvx.php?action=clear\">Rensa databas</a><br>");
}

//echo("</div>"); // main
echo("</body></html>");
//$k1 = msTimeStamp();$temp = $k1-$k0;echo("A3 $temp <br>");$k0=$k1;


?>

